{extend name="index/base" /}
{block name='title'}Order Comment{/block}
{block name='content'}
{selfTag:multiDetail varName="orderGoodsModel" table="o_goods" where='["id"=>input("id")]' /}
<div class="container clearfix my-5 pb-1">
    {include file="user/leftMenu" name="Reviews&Show" route="user/review"/}

    <div class="userBox">
            <div class="userH_tab clearfix">
                <a href="/user/review" class="on" >To Be Evaluated</a>
                <a href="/user/reviewmine" >My Reviews</a>
            </div>

        <div class="review-content">
            <div class="to-be-evaluated">
                <div class="items">
                    <div class="items-info">
                        <a class="d-block image">
                            <img src="{$orderGoodsModel['img']}" alt="Product">
                        </a>
                        <div class="info">
                            <h3 class="product-title">
                                <a href="">{$orderGoodsModel['name']}</a>
                            </h3>
                            <div class="price pb-2">{$money_f}{$orderGoodsModel['price']}</div>

                            <div class="fs-sm">
                                <span class="text-muted me-2">{$orderGoodsModel['sku_name']}</span>
                            </div>
                        </div>
                    </div>

                </div>


            </div>
            <el-form ref="form" :model="temp" label-position="top" label-width="80px">
                <el-form-item label="Rating Stars">
                    <el-rate v-model="temp.level"></el-rate>
                </el-form-item>

                <el-form-item label="Your Feedback">
                   <el-input v-model="temp.content" type="textarea" :rows="6"/>
                </el-form-item>

                <el-form-item label="Customer Picture">
                    <file-upload ref="fileUpload" :show-file-list="true" list-type="picture-card">
                    </file-upload>
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" :loading="submitLoading" @click="handleSubmit">Submit Review</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</div>

{/block}
{block name='script'}

<script>

    layui.extend({

        fileUpload: 'vue-components/fileUpload',
    }).use(['fileUpload'], function (fileUpload) {
        initVue({
            data: {
                submitLoading:false,
                temp:{
                    level: 5,
                    cond_id:"{:input('id')}",
                },
            },
            components: {
                'file-upload': fileUpload
            },
            computed: {

            },
            created: function () {

            },
            mounted: function () {
            },
            methods: {
                handleSubmit:function(){
                    const that = this
                    this.submitLoading = true
                    this.$network('comment/orderGoodsComment',Object.assign({},this.temp,{img:this.$refs['fileUpload'].getImage()})).then(function(res){
                        that.submitLoading =false
                        that.$message.success(res.msg)
                        window.history.back()
                    }).catch(function(err){
                        that.submitLoading =false
                    })

                },


            },
        })


    })

</script>


{/block}